﻿Imports Microsoft.Practices.Composite.Modularity
Imports Microsoft.Practices.Unity
Imports Infragistics.Windows.Ribbon
Imports Microsoft.Practices.Composite.Regions
Imports Hinshelwood.TFSStickyBuddy.Infrastructure
Imports Hinshelwood.TFSStickyBuddy.Modules.Interfaces
Imports Hinshelwood.TFSStickyBuddy.Modules.Controllers
Imports Hinshelwood.TFSStickyBuddy.Modules.Presenters
Imports Hinshelwood.TFSStickyBuddy.Modules.Views
Imports Hinshelwood.TFSStickyBuddy.Modules.PresentationModels

Public Class AreaIterationModule
    Implements IModule

    Private ReadOnly m_container As IUnityContainer
    Private ReadOnly m_regionManager As IRegionManager
    Private ReadOnly m_NavigationService As INavigationService

    Public Sub New(ByVal container As IUnityContainer, ByVal regionManager As IRegionManager, ByVal NavigationService As INavigationService)
        m_container = container
        m_regionManager = regionManager
        m_NavigationService = NavigationService
    End Sub

    Public Sub Initialize() Implements Microsoft.Practices.Composite.Modularity.IModule.Initialize
        RegisterViewsAndServices()
        ' Setup Menus and Nav
        Dim controller As IAreaIterationController = m_container.Resolve(Of IAreaIterationController)()
        'InfragisticsHelper.MergeRibbon(m_regionManager, New FeedbackRibbonTemplate)
        m_NavigationService.AddButtonTool("Tree By Area", controller.TreeByAreaCommand, Nothing, RegionNames.Shell_Ribbon_HomeTab_DashboardsGroup)
        m_NavigationService.AddButtonTool("Tree By Iteration", controller.TreeByIterationCommand, Nothing, RegionNames.Shell_Ribbon_HomeTab_DashboardsGroup)
        ' Add Contextual Tabs
        m_NavigationService.RegisterContextualTabGroupRegion(RegionNames.AreaIteration_TreeTabGroup, "Tree")
    End Sub

    Protected Sub RegisterViewsAndServices()
        m_container.RegisterType(Of IAreaIterationController, AreaIterationController)(New ContainerControlledLifetimeManager())
        ' Add Tree By Iteration Bits
        m_container.RegisterType(Of ITreeByPresentationModel, TreeByPresentationModel)()
        m_container.RegisterType(Of ITreeByPresenter, TreeByPresenter)()
        m_container.RegisterType(Of ITreeByView, TreeByView)()
    End Sub




End Class
